package chain.service;

import chain.Chain;

/**
 * 信用管理机构
 * @author ChangSir
 *
 */
public class FiduciaryChain implements Chain {

	private Chain nextChain;
	
	@Override
	public void setNextChain(Chain nextChain) {
		this.nextChain = nextChain;
	}
	
	/**
	 * 处理信用分值
	 */
	@Override
	public void handlerMessage(int value) {
		if(value < 80) {
			//信用分低于80，直接退回
			System.out.println("[流程] 您的信用分不够");
		} else {
			//下一责任不为空，处理下一责任
			if(null != nextChain) {
				System.err.println("[流程] 通过信用机构允许------->>>>>>");
				nextChain.handlerMessage(value);
			} else {
				System.out.println("[流程] 流程已结束");
			}
		}
	}

}